﻿@using PagedList.Mvc;
@{
    PagedList.IPagedList<Model.Origins.OriginsTempletModel> myPageList = (PagedList.IPagedList<Model.Origins.OriginsTempletModel>)ViewBag.PageList;
    Layout = "~/Views/Shared/MyLayOutNew.cshtml";
}
<!DOCTYPE html>

<link href="~/Content/PagedList.css" rel="stylesheet" />
<main class="main-cont content mCustomScrollbar">
    <div class="page-wrap">
        <!--开始::内容-->
        <section class="page-hd">
            <header>
                <h2 class="title">码管理>>绑码</h2>
                <p class="title-description">
                    <div class="fr input-group">
                        <input id="inputTxt" type="text" class="form-control" placeholder="模板名称或机构名称..." style="width:290px;" />
                        <button class="btn btn-secondary-outline" onclick="seacrh()">搜索</button>
                    </div> 
                </p>
            </header>
            <hr>
        </section>
        <table class="table mb-15">
            <thead>
                <tr>
                    <th><input type="checkbox" /></th>
                    <th>溯源模板名称</th>
                    <th>所属机构</th>
                    <th>创建日期</th>
                   
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>

                @foreach (var item in myPageList)
                {
                    <tr class="cen">
                        <td><input type="checkbox" /></td>
                        <td>
                            @Html.DisplayFor(modelItem => item.Name)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.EnterpriseName)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.CreateDate)
                        </td>
                        <td>
                            <a title="编辑" class="mr-5" onclick="BindCode(@item.ID,@item.EnterpriseId)">绑码</a>
                            <a title="编辑" class="mr-5" onclick="Edit(@item.ID)">编辑模板</a>
                           
                        </td>
                    </tr>
                }

            </tbody>
        </table>
        每页 @myPageList.PageSize 条记录，共 @myPageList.PageCount 页，当前第 @myPageList.PageNumber 页
        @Html.PagedListPager(myPageList, page => Url.Action("Index", new { page }))
        <!--开始::结束-->
    </div>
</main>
<script type="text/javascript">
    function seacrh() {
        var str = $("#inputTxt").val();
        window.location.href = "/BindCode/Index?page=1&term=" + str;
    }
    function BindCode(id,EnterpriseId) {
        
        window.location.href = "/BindCode/Edit?id="+id+"&EnterpriseId="+EnterpriseId;
    }
    function Edit(id) { 
        window.location.href = "/Jtsy/EditPhone?oper=edit&tempId="+id;
    }
</script>